Bar codes have been used in a wide variety of applications as a source for information, for instance for product identification and pricing. A bar code is a set of binary numbers and typically consists of black bars and white spaces, or black and white squares. One-dimensional barcodes are typically consisted of black and white lines, while two-dimensional barcodes are arrays of black and white squares or hexagons or ellipses. Usually the standard classical devices utilized for bar code detection use laser beams (for example, dedicated devices used in supermarkets and stores). Since many mobile devices are already equipped with cameras, it also is possible to arrange bar code detection in these devices.
The physical dimension of the bar codes to be detected varies quite a lot. Bar codes that have low information density on a large area can be detected easily with a normal camera phone. This is because, for such bar codes, the distance between the printed bar code and the lens of the camera must be long in order to include the complete bar code in the viewfinder. In this case the image containing the bar code is situated in the in-focus range of the camera and the quality of the captured image is typically good enough for detection. On the other hand, for the bar codes printed on small areas—even if they have low information density—the distance between the printed code and the camera must be very short. This is due to the fact that for such small codes, the resolution of the printed bar code, situated in the in-focus range of the camera, is around the maximum resolution of the optical system of the camera phone. In order to deal with this problem, the bar code is captured at a distance that is much shorter than the focal distance of the camera. However, when a bar code is captured at a very short distance, the captured image is highly influenced by the distortions of the optical system and sensor of the camera (out of focus). Typically, the captured image is distorted by: sensor noise added to the captured image, optical blur and vignetting that are due to the optical system of the camera (lenses). An example of such an image captured using a short distance between the camera and the printed bar code is depicted in FIG. 1. It is likely that bar code detection applied directly to this image will fail due to the amount of blurring and, therefore, pre-processing is desirable.
One way to improve the quality of the captured image for small bar codes is to use lenses with a very short focal distance that introduce very little blur in the captured image. However, using such a lens requires additional external attachments to the mobile phones, and can cause discomfort and annoy the users. Also, this will add more costs.
IEEE publication “Bar Code Recovery via the EM Algorithm”, William Turin and Robert A. Boie, IEEE Transactions on Signal Processing, Vol. 46, No. 2, February 1998, pages 354-363, discloses a bar code recovery method based on the statistical expectation-maximization (EM) algorithm. In this method a bi-level bar code is blurred and fitted to the input line. The point spread function (psf) is assumed to be gaussian and the positions of the bar code edges are assumed to be unknown. The parameter of the psf is also assumed to be unknown. The maximum likelihood approach is used to find the position of the bar code edges. This reference is limited to describe a solution for situations where the amount of blur is small. For medium and highly blurred images there are no examples in the referred paper that illustrate the performance of that method. Moreover, the method mentioned in this reference is derived for bar code detectors based on infrared sensors and the model of such sensors is used in the derivation of the algorithms and methods. In addition to that, the algorithm proposed in the above paper has a large computational complexity that makes it unsuitable for implementation in mobile devices.